package com.zzedu.web.controller;

import com.zzedu.common.annotation.Log;
import com.zzedu.common.enums.BusinessType;
import com.zzedu.common.enums.OperatorType;
import com.zzedu.manager.IZzExerciseBookManager;
import com.zzedu.result.Result;
import com.zzedu.stu.req.SubmitExerciseBook;
import com.zzedu.utils.BaseReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 作业本服务
 */
@RestController
@RequestMapping("/exercisebook")
public class ExerciseBookController {

    @Autowired
    IZzExerciseBookManager zzExerciseBookManager;

    /**
     * 提交作业
     *
     * @return
     */
    @RequestMapping(value = "/submit", method = {RequestMethod.GET, RequestMethod.POST})
    @Log(title = "作业-提交", businessType = BusinessType.APP_STUDENT, operatorType = OperatorType.MOBILE)
    public Result submit(@Validated @RequestBody BaseReq<SubmitExerciseBook> baseRequest) {
        return zzExerciseBookManager.submit(baseRequest.getData());
    }

}
